<?php

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

/**
 * 初始化管理员
 * Class AdminsTableSeeder
 */
class AdminsTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        DB::table('admins')->truncate();

        /* 插入 */
        DB::table('admins')->insert([
            'id' => 1,
            'username' => 'admin',
            'password' => bcrypt('123456'),
            'nickname' => 'Administrator',
            'email' => '',
            'img' => '',
            'status' => 1,
            'last_login_ip' => '',
            'last_login_time' => 0,
            'created_at' => date('Y-m-d H:i:s'),
            'updated_at' => date('Y-m-d H:i:s'),
        ]);

        /* 删除角色权限 */

        DB::table('admin_roles')->truncate();

        /* 插入 */
        DB::table('admin_roles')->insert([
            'id' => 1,
            'admin_id' => 1,
            'role_id' => 1
        ]);
    }
}
